Mobile support to come.
import { getCurrentUser, getQuestion } from "@/lib/dal";
import { cn } from "@/util";
import { AnswerCard } from "./ui/answer-card";
import { AnswerForm } from "./ui/answer-form";
import { AnswersStripe } from "./ui/answers-stripe";
import { QuestionCard } from "./ui/question-card";
export default async function Page({
params,
}: {
params: Promise<{ owner: string; repo: string; number: number }>;
}) {
const { owner, repo, number } = await params;
const [user, question] = await Promise.all([
getCurrentUser(),
getQuestion(owner, repo, number),
]);
if (!question) return null;
const { answers } = question;
const hasUserAnswer = answers.find((answer) => answer.author_id === user?.id);
return (
<div className="w-full">
<div className="flex flex-col flex-1 min-w-0 pb-20">
<div className="max-w-4xl pt-4 border-border border-r">
<QuestionCard question={question} owner={owner} repo={repo} />
</div>
<div className="w-full border-border border-b" />
<div
className={cn(
"max-w-4xl border-border border-r",
answers.length > 0 && "pb-4",
)}
>
<AnswersStripe count={answers.length} />
</div>
<div className="flex flex-col max-w-4xl">
{answers.length > 0 && (
<div className="flex flex-col gap-12 border-border border-r border-b">
{answers.map((answer) => (
<AnswerCard
key={answer.id}
answer={answer}
owner={owner}
repo={repo}
number={question.number}
/>
))}
</div>
)}
{!hasUserAnswer && (
<AnswerForm owner={owner} repo={repo} number={number} />
)}
</div>
</div>
</div>
);
}
answers form.... a design in progress definitely not ready yet eh
baepaul•492dd4610d ago
more _things_
baepaul•d2da18e10d ago
nits, fixing answer form flicker and stuff
baepaul•7969fad10d ago
instrumenting blockers on quite a few places..
baepaul•766630310d ago
making unauth views work, but introduces flicker for answer form on questions...
baepaul•38d9d4b11d ago
reorganizign repo under (main)
baepaul•63f342411d ago